package com.dreamsky.life.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;

public class User extends Model<User> {

	public static User dao = new User();

	public User loginFind() {
		return findFirst(
				"select * from lf_user where user_name=? and user_pwd=?",
				getStr("user_name"), getStr("user_pwd"));
	}

	/**
	 * 得到用户的电器
	 * 
	 * @return
	 */
	public List<Electric> userEletric(Object... userId) {
		String sql = "select id,ele_name,ele_state from lf_electric where user_id=?";

		return Electric.dao.find(sql, userId == null ? get("id") : userId);

	}
}
